<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml" xmlns:sec="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8">
  <title>发表问题 编辑问题 公用</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="keywords" content="fly,layui,前端社区">
  <meta name="description" content="Fly社区是模块化前端UI框架Layui的官网社区，致力于为web开发提供强劲动力">
  <link rel="stylesheet" href="/res/layui/css/layui.css">
  <link rel="stylesheet" href="/res/css/global.css">
</head>
<body>
<!--头部-->
<div th:replace="~{layout/head_layout :: head_layout}"></div>

<div class="layui-container fly-marginTop">
  <div class="fly-panel" pad20 style="padding-top: 5px;">
    <!--<div class="fly-none">没有权限</div>-->
    <div class="layui-form layui-form-pane">
      <div class="layui-tab layui-tab-brief" lay-filter="user">
        <ul class="layui-tab-title">
          <li class="layui-this">发表新帖<!-- 编辑帖子 --></li>
        </ul>
        <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
          <div class="layui-tab-item layui-show">
            <div>
              <div class="layui-row layui-col-space15 layui-form-item">
                <div class="layui-col-md3">
                  <label class="layui-form-label">所在专栏</label>
                  <div class="layui-input-block" style="z-index: 2">
                    <select lay-verify="required" name="class" lay-filter="column">
                      <option></option>
                      <option value="1">提问</option>
                      <option value="2">分享</option>
                      <option value="3">讨论</option>
                      <option value="4">建议</option>
                      <option value="5" sec:authorize="hasRole('ROLE_ADMIN')">动态</option>
                      <option value="6" sec:authorize="hasRole('ROLE_ADMIN')">公告</option>
                    </select>
                  </div>
                </div>
                <div class="layui-col-md9">
                  <label for="L_title" class="layui-form-label">标题</label>
                  <div class="layui-input-block">
                    <input type="text" id="L_title" name="title" required lay-verify="required"
                           autocomplete="off" class="layui-input">
                    <!-- <input type="hidden" name="id" value="{{d.edit.id}}"> -->
                  </div>
                </div>
              </div>
              <div class="layui-form-item layui-form-text" style="height: 530px;">
                <div class="layui-input-block">
                  <div id="editor" style="height:525px;">
                    <p>欢迎使用 <b>wangEditor</b> 富文本编辑器</p>
                  </div>
                </div>
              </div>
              <div class="layui-form-item">
                <div class="layui-inline">
                  <label class="layui-form-label">悬赏飞吻</label>
                  <div class="layui-input-inline" style="width: 190px;">
                    <select name="experience">
                      <option value="20">20</option>
                      <option value="30">30</option>
                      <option value="50">50</option>
                      <option value="60">60</option>
                      <option value="80">80</option>
                    </select>
                  </div>
                  <div class="layui-form-mid layui-word-aux">发表后无法更改飞吻</div>
                </div>
              </div>
              <div class="layui-form-item">
                <label for="L_vercode" class="layui-form-label">人类验证</label>
                <div class="layui-input-inline">
                  <input type="text" id="L_vercode" name="vercode" required lay-verify="required"
                         placeholder="请回答后面的问题" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid">
                  <span style="color: #c00;">1+1=?</span>
                </div>
              </div>
              <div class="layui-form-item">
                <button class="layui-btn" lay-filter="add" lay-submit>立即发布</button>
                <button class="layui-btn layui-btn-primary" id="preview">预览</button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

<div class="fly-footer">
  <p><a href="http://fly.layui.com/" target="_blank">Fly社区</a> 2017 &copy; <a
      href="http://www.layui.com/" target="_blank">layui.com 出品</a></p>
  <p>
    <a href="http://fly.layui.com/jie/3147/" target="_blank">付费计划</a>
    <a href="http://www.layui.com/template/fly/" target="_blank">获取Fly社区模版</a>
    <a href="http://fly.layui.com/jie/2461/" target="_blank">微信公众号</a>
  </p>
</div>

<script src="/res/layui/layui.js"></script>
<script type="text/javascript" src="/res/js/wangEditor.min.js"></script>
<script>
  var E = window.wangEditor
  var editor = new E('#editor')
  editor.customConfig.zIndex = 0
  //注意：选项卡 依赖 element 模块，否则无法进行功能性操作
  layui.use(['element', 'form', 'jquery'], function () {
    var element = layui.element;
    var form = layui.form;
    var $ = layui.jquery;

    //预览
    $('#preview').click(function () {
      layer.open({
        title: '内容预览'
        , area: ['55%', '100%']
        , offset: 'rt'
        , content: '<div style="padding: 10px 35px;">'+editor.txt.html()+'</div>'
      });
    })

    //监听提交
    form.on('submit(add)', function (data) {
      layer.msg(JSON.stringify(data.field));
      return false;
    });

    // 表情面板可以有多个 tab ，因此要配置成一个数组。数组每个元素代表一个 tab 的配置
    editor.customConfig.emotions = [
      {
        // tab 的标题
        title: '默认',
        // type -> 'emoji' / 'image'
        type: 'image',
        // content -> 数组
        content: [{"src": "/res/layui/images/face/0.gif", "alt": "微笑"},
          {"src": "/res/layui/images/face/1.gif", "alt": "嘻嘻"},
          {"src": "/res/layui/images/face/2.gif", "alt": "哈哈"},
          {"src": "/res/layui/images/face/3.gif", "alt": "可爱"},
          {"src": "/res/layui/images/face/4.gif", "alt": "可怜"},
          {"src": "/res/layui/images/face/5.gif", "alt": "挖鼻"},
          {"src": "/res/layui/images/face/6.gif", "alt": "吃惊"},
          {"src": "/res/layui/images/face/7.gif", "alt": "害羞"},
          {"src": "/res/layui/images/face/8.gif", "alt": "挤眼"},
          {"src": "/res/layui/images/face/9.gif", "alt": "闭嘴"},
          {"src": "/res/layui/images/face/10.gif", "alt": "鄙视"},
          {"src": "/res/layui/images/face/11.gif", "alt": "爱你"},
          {"src": "/res/layui/images/face/12.gif", "alt": "泪"},
          {"src": "/res/layui/images/face/13.gif", "alt": "偷笑"},
          {"src": "/res/layui/images/face/14.gif", "alt": "亲亲"},
          {"src": "/res/layui/images/face/15.gif", "alt": "生病"},
          {"src": "/res/layui/images/face/16.gif", "alt": "太开心"},
          {"src": "/res/layui/images/face/17.gif", "alt": "白眼"},
          {"src": "/res/layui/images/face/18.gif", "alt": "右哼哼"},
          {"src": "/res/layui/images/face/19.gif", "alt": "左哼哼"},
          {"src": "/res/layui/images/face/20.gif", "alt": "嘘"},
          {"src": "/res/layui/images/face/21.gif", "alt": "衰"},
          {"src": "/res/layui/images/face/22.gif", "alt": "委屈"},
          {"src": "/res/layui/images/face/23.gif", "alt": "吐"},
          {"src": "/res/layui/images/face/24.gif", "alt": "哈欠"},
          {"src": "/res/layui/images/face/25.gif", "alt": "抱抱"},
          {"src": "/res/layui/images/face/26.gif", "alt": "怒"},
          {"src": "/res/layui/images/face/27.gif", "alt": "疑问"},
          {"src": "/res/layui/images/face/28.gif", "alt": "馋嘴"},
          {"src": "/res/layui/images/face/29.gif", "alt": "拜拜"},
          {"src": "/res/layui/images/face/30.gif", "alt": "思考"},
          {"src": "/res/layui/images/face/31.gif", "alt": "汗"},
          {"src": "/res/layui/images/face/32.gif", "alt": "困"},
          {"src": "/res/layui/images/face/33.gif", "alt": "睡"},
          {"src": "/res/layui/images/face/34.gif", "alt": "钱"},
          {"src": "/res/layui/images/face/35.gif", "alt": "失望"},
          {"src": "/res/layui/images/face/36.gif", "alt": "酷"},
          {"src": "/res/layui/images/face/37.gif", "alt": "色"},
          {"src": "/res/layui/images/face/38.gif", "alt": "哼"},
          {"src": "/res/layui/images/face/39.gif", "alt": "鼓掌"},
          {"src": "/res/layui/images/face/40.gif", "alt": "晕"},
          {"src": "/res/layui/images/face/41.gif", "alt": "悲伤"},
          {"src": "/res/layui/images/face/42.gif", "alt": "抓狂"},
          {"src": "/res/layui/images/face/43.gif", "alt": "黑线"},
          {"src": "/res/layui/images/face/44.gif", "alt": "阴险"},
          {"src": "/res/layui/images/face/45.gif", "alt": "怒骂"},
          {"src": "/res/layui/images/face/46.gif", "alt": "互粉"},
          {"src": "/res/layui/images/face/47.gif", "alt": "心"},
          {"src": "/res/layui/images/face/48.gif", "alt": "伤心"},
          {"src": "/res/layui/images/face/49.gif", "alt": "猪头"},
          {"src": "/res/layui/images/face/50.gif", "alt": "熊猫"},
          {"src": "/res/layui/images/face/51.gif", "alt": "兔子"},
          {"src": "/res/layui/images/face/52.gif", "alt": "ok"},
          {"src": "/res/layui/images/face/53.gif", "alt": "耶"},
          {"src": "/res/layui/images/face/54.gif", "alt": "good"},
          {"src": "/res/layui/images/face/55.gif", "alt": "NO"},
          {"src": "/res/layui/images/face/56.gif", "alt": "赞"},
          {"src": "/res/layui/images/face/57.gif", "alt": "来"},
          {"src": "/res/layui/images/face/58.gif", "alt": "弱"},
          {"src": "/res/layui/images/face/59.gif", "alt": "草泥马"},
          {"src": "/res/layui/images/face/60.gif", "alt": "神马"},
          {"src": "/res/layui/images/face/61.gif", "alt": "囧"},
          {"src": "/res/layui/images/face/62.gif", "alt": "浮云"},
          {"src": "/res/layui/images/face/63.gif", "alt": "给力"},
          {"src": "/res/layui/images/face/64.gif", "alt": "围观"},
          {"src": "/res/layui/images/face/65.gif", "alt": "威武"},
          {"src": "/res/layui/images/face/66.gif", "alt": "奥特曼"},
          {"src": "/res/layui/images/face/67.gif", "alt": "礼物"},
          {"src": "/res/layui/images/face/68.gif", "alt": "钟"},
          {"src": "/res/layui/images/face/69.gif", "alt": "话筒"},
          {"src": "/res/layui/images/face/70.gif", "alt": "蜡烛"},
          {"src": "/res/layui/images/face/71.gif", "alt": "蛋糕"}]
      }
    ]
    // 或者 var editor = new E( document.getElementById('editor') )
    editor.create()
    $('.w-e-text-container').css('height', '500px');
  });
</script>

</body>
</html>
